<!doctype html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="_xsrf" content="{{.xsrf_token}}" />
    <title>用户登录界面</title>
    <link rel="stylesheet" type="text/css" href="/static/login/css/default.css"/>
    <link rel="stylesheet" type="text/css" href="/static/login/css/styles.css"/>
    <!--[if IE]>
    <script src="/static/login/js/html5shiv.min.js"></script>
    <![endif]-->
</head>
<body>
<article class="htmleaf-container">
    <header class="htmleaf-header">
        <h1>用户登录界面</h1>
        <div class="htmleaf-links">

        </div>
    </header>
    <div class="panel-lite">
        <form>
        <div class="thumbur">
            <div class="icon-lock"></div>
        </div>
        <h4>用户登录</h4>
        <div class="form-group">
            <input type="text" name="username" required="required" class="form-control"/>
            <label class="form-label">用户名    </label>
        </div>
        <div class="form-group">
            <input type="password" name="password" required="required" class="form-control"/>
            <label class="form-label">密　码</label>
        </div>
        <!--<a href="#">忘记密码 ?  </a>-->
        <button class="floating-btn"><i class="icon-arrow"></i></button>
        </form>
    </div>

</article>
<div style="text-align:center;">
</div>
</body>
</html>
<script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<script>
    //监听提交
    $(".floating-btn").click(function(){
        var form_data = $("form").serialize();
        var xsrftoken = $('meta[name=_xsrf]').attr('content');
        $.ajax({
            type: "post",
            url:'{{urlfor "AdminController.Login"}}',
            dataType: "json",
            data: form_data,
            headers : {'X-Xsrftoken':xsrftoken},
            success: function(out){
//                console.log(out);return false;
                if (out.status == 0) {
                        window.location.href="/admin/lst"
                } else {
                    alert(out.message)
                }
            },
            error: function(out){
                alert("未知错误");
            }

        });
        return false;
    });
</script>